package com.ywu.role.standard.api;

import com.ywu.common.result.CommonResult;
import com.ywu.role.standard.dto.ApiRoleAuthDto;
import com.ywu.role.standard.dto.ApiRoleAuthRolePermissionDto;
import com.ywu.role.standard.service.ApiRoleAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName ApiRoleAuthApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2025/3/21 19:52
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/role/auth")
public class ApiRoleAuthApi {
    @Autowired
    private ApiRoleAuthService apiRoleAuthService;

    /**
     * @Author GroundDemo
     * @Description 查询API关联的角色
     * @Date 22:01 2024/3/9
     * @Param [apiRoleAuthDto]
     * @return com.ywu.common.result.CommonResult<java.lang.Object>
     **/
    @PostMapping("/api.role.info")
    public CommonResult<Object> queryApiRoleInfo(@RequestBody ApiRoleAuthDto apiRoleAuthDto) {
        return apiRoleAuthService.queryApiRoleInfo(apiRoleAuthDto);
    }

    /**
     * @Author GroundDemo
     * @Description API角色授权管理
     * @Date 22:12 2024/3/9
     * @Param [apiRoleAuthDtos]
     * @return com.ywu.common.result.CommonResult<java.lang.Object>
     **/
    @PostMapping("/api.role.auth.create.info")
    public CommonResult<Object> apiRoleAuthCreateInfo(@RequestBody ApiRoleAuthRolePermissionDto apiRoleAuthDtos) {
        return apiRoleAuthService.apiRoleAuthCreateInfo(apiRoleAuthDtos);
    }

    /**
    * @Author GroundDemo
    * @Description 删除api授权信息
    * @Date 19:17 2025/3/26
    * @Param [apiRoleAuthDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/api.role.auth.delete.info")
    public CommonResult<Object> apiRoleAuthDeleteInfo(@RequestBody ApiRoleAuthDto apiRoleAuthDto) {
        return apiRoleAuthService.apiRoleAuthDeleteInfo(apiRoleAuthDto);
    }
}
